<?php

/******************************************
 * File:			lib_sessions.php
 * Version:			1.0.1
 * Last modified:	25/10/2009
 * Last modifier:	Hugo Lavigne
 *****************************************/

#Starting sessions
	@session_register("SESSION");

	if (!isset($_SESSION['valid']))
		$_SESSION['valid'] = "ko";
	if (!isset($_SESSION['config']))
		$_SESSION['config'] = "ko";
	if (!isset($_SESSION['admin']))
		$_SESSION['admin'] = "ko";
	if (!isset($_SESSION['login']))
		$_SESSION['login'] = "";
	if (!isset($_SESSION['path_php']))
		$_SESSION['path_php'] = $path_php;

Function make_session()
{
	if ($_SESSION['config'] == "ko")
	{
		require ($_SESSION['path_config_path']);
		require ($_SESSION['path_config_default']);
		require ($_SESSION['path_config_mysql']);
		require ($_SESSION['path_config_version']);
		if (file_exists($_SESSION['path_config_ldap']))
			require ($_SESSION['path_config_ldap']);
	  
		$_SESSION['path_apps'] = $path_apps;
		$_SESSION['path_php'] = $path_php;
		$_SESSION['path_js'] = $path_js;
		$_SESSION['path_core'] = $path_core;
		$_SESSION['path_swf'] = $path_swf;
		$_SESSION['path_css'] = $path_css;
		$_SESSION['path_users'] = $path_users;
		$_SESSION['path_images'] = $path_images;
		$_SESSION['path_templates'] = $path_templates;
		$_SESSION['path_webadmin'] = $path_webadmin;

		$_SESSION['server'] = $server_mysql;
		$_SESSION['server_mysql'] = $server_mysql;
		$_SESSION['user_mysql'] = $user_mysql;
		$_SESSION['pass_mysql'] = $pass_mysql;
		$_SESSION['database'] = $database;
		$_SESSION['prefix'] = $prefix;

		$_SESSION['status'] = $status;
		$_SESSION['title'] = $title;
		@$_SESSION['subtitle'] = $subtitle;
		$_SESSION['users_auth'] = $auth;

		$_SESSION['ver_wup'] = $pwr;
		$_SESSION['release_wup'] = $pwl;

		if (file_exists($_SESSION['path_config_ldap']))
		{
			$_SESSION['server_ldap'] = $server_ldap;
			$_SESSION['domain_ldap'] = $domain_ldap;
		}
		
		$_SESSION['template'] = $template_default;
		$_SESSION['config'] = "ok";
	}
	else
	{
		require ($_SESSION['path_config_version']);
		require ($_SESSION['path_config_default']);
		
		$_SESSION['status'] = $status;
		$_SESSION['title'] = $title;
		@$_SESSION['subtitle'] = $subtitle;
	}
	return(0);
}

?>